home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / dev / c / SASCOptsPlus_s.lha / SASCOptionsMain.c < prev    next >
C/C++ Source or Header  |  1998-02-07  |  8KB  |  275 lines

  1. /* SCOptsPlus
  2.    Copyright (©) 1997, Infinity Labs Development Organization
  3.    All Rights Reserved
  4.    Author: Manolis S. Pappas
  5.           Thermopilon 24
  6.        14231 Nea Ionia
  7.        Athens, GREECE
  8. */
  9.  
  10. /* Main program code */
  11.  
  12. /* Libraries */
  13. #include <libraries/mui.h>
  14. #include <libraries/gadtools.h> /* for BARLABEL in MenuItem */
  15.  
  16. /* Prototypes */
  17. #include <clib/muimaster_protos.h>
  18. #include <clib/exec_protos.h>
  19. #include <clib/alib_protos.h>
  20. #include <clib/dos_protos.h>
  21. #include <clib/icon_protos.h>
  22.  
  23. /*  Pragmas  */
  24. #ifdef __MAXON__
  25. #include <proto/muimaster_lib.h>
  26. #include <proto/exec_lib.h>
  27. #else
  28. #include <pragmas/muimaster_pragmas.h>
  29. #include <pragmas/exec_pragmas.h>
  30. #endif
  31.  
  32. /*  Ansi  */
  33. #include <stdlib.h>
  34. #include <stdio.h>
  35.  
  36. /* System */
  37. #ifdef __SASC__
  38. #include <dos.h>
  39. #endif
  40.  
  41. /* Include generated by GenCodeC */
  42. #include "SASCOptionsGUI.h"
  43.  
  44. /* Safe memory allocations (only for DEBUG) */
  45. #ifdef DEBUG
  46. #include "mem.h"
  47. #endif
  48.  
  49. /* Definition of the EasyRequest structure */
  50. struct EasyStruct miniErrorreq={
  51.     sizeof(struct EasyStruct),
  52.     0,
  53.     "SCOpts+ Error Message",
  54.     "%s",
  55.     "Ok",
  56. };
  57.  
  58. /* Declarations for libraries (inserted by GenCodeC) */
  59. struct Library * MUIMasterBase;
  60. struct Library * IconBase;
  61.  
  62. /* Program Functions (called by hooks) */
  63. APTR h_ABOUT( struct Hook *a0, APTR a2, APTR a1 );        /* About Program */
  64. APTR h_ABOUT_MUI( struct Hook *a0, APTR a2, APTR a1 );        /* About MUI */
  65. APTR h_RESTORE_SCOPTS( struct Hook *a0, APTR a2, APTR a1 );    /* Restore from */
  66. APTR h_RESTORE_ENV( struct Hook *a0, APTR a2, APTR a1 );    /* Restore from */
  67. APTR h_RESTORE( struct Hook *a0, APTR a2, APTR a1 );        /* Restore from... */
  68. APTR h_RESTORE_DEF( struct Hook *a0, APTR a2, APTR a1 );    /* Restore from SAS/C */
  69. APTR h_SAVE_SCOPTS( struct Hook *a0, APTR a2, APTR a1 );    /* Save to SCOPTIONS */
  70. APTR h_SAVE_ENV( struct Hook *a0, APTR a2, APTR a1 );        /* Save to ENV: */
  71. APTR h_SAVE( struct Hook *a0, APTR a2, APTR a1 );        /* Save as... */
  72.  
  73. /* Program functions (called by reference) */
  74. void default_opts(void);
  75.  
  76.  
  77. /* Compiler Options Parameters (default values by SAS/C, 0=NO) */
  78.  
  79. /*
  80. /* Compiler */
  81. int comp_debug=0; /* nodebug */
  82. int comp_shortint=0; /* noshortintegers */
  83. int comp_stringmerge=0; /* nostringmerge */
  84. int comp_uchar=0; /* nounsignedchar */
  85. int comp_cnest=0; /* nocommentnest */
  86. int comp_mincludes=0; /*multipleincludes */
  87. int comp_gstimm=0; /* nogstimmediate */
  88. int comp_icons=1; /* icons */
  89. int comp_modified=0; /* nomodified */
  90. int comp_pponly=0; /* nopponly */
  91. int comp_cxxonly=0; /* nocxxonly */
  92. int comp_memsize=3; /* memsize=large */
  93. int comp_strconst=0; /* nostringconst */
  94. int comp_wvoidreturn=1; /* nowarnvoidreturn */
  95. int comp_mccconstants=0; /* nomccconstants */
  96.  
  97. /* Message */
  98. int msg_ansi=0; /* noansi */
  99. int msg_strict=0; /* nostrict */
  100. int msg_erexx=0; /* noerrorrexx */
  101. int msg_econsole=1; /* errorconsole */
  102. int msg_elist=1; /* errorlisting */
  103. int msg_esource=1; /* errorsource */
  104. int msg_ehighlt=1; /* errorhighlight */
  105. int msg_structequiv=0; /* nostructureequivallence */
  106. int msg_onerror=0; /* onerror=stop */
  107.  
  108. /* Code */
  109. int code_data=0; /* data=near */
  110. int code_code=0; /* code=near */
  111. int code_strsect=0; /* strsect=default */
  112. int code_math=0; /* nomath */
  113. int code_precision=0; /* precision=mixed */
  114. int code_cpu=0; /* cpu=68000 */
  115. int code_parms=0; /* parms=stack */
  116. int code_stkext=0; /* nostackextend */
  117. int code_stkchk=1; /* stackcheck */
  118. int code_saveds=0; /* nosaveds */
  119. int code_datamem=0; /* datamem=any */
  120. int code_areg=1; /* autoregister */
  121. int code_utillib=0; /* noutillib */
  122. int code_clibbase=1; /* constlibbase */
  123. int code_libcode=0; /* nolibcode */
  124. int code_absfuncpointer=0; /* noabsfuncpointer */
  125. int code_common=0; /* nocommon */
  126. int code_coverage=0; /* nocoverage */
  127. int code_profile=0; /* noprofile */
  128.  
  129. /* List */
  130. int list_macros=0; /* nolistmacros */
  131. int list_includes=0; /* nolistincludes */
  132. int list_headers=1; /* listheaders */
  133. int list_system=0; /* nolistsystem */
  134. int list_narrow=1; /* listnarrow */
  135. int list_errorlisting=1; /* errorlisting */
  136. int list_xrefsystem=0; /* noxrefsystem */
  137. int list_xrefheaders=0; /* noxrefheaders */
  138.  
  139. /* Optimizer */
  140. int opt_global=1; /* optimizeglobal */
  141. int opt_peep=1; /* optimizepeep */
  142. int opt_schedule=0; /* nooptimizeschedule */
  143. int opt_inline=1; /* optimizeinline */
  144. int opt_inlocal=0; /* nooptinlocal */
  145. int opt_loop=1; /* optloop */
  146. int opt_size=0; /* nooptsize */
  147. int opt_time=0; /* noopttime */
  148. int opt_alias=0; /* nooptalias */
  149. int opt_comp=0; /* optcomp=0 */
  150. int opt_depth=0; /* optdepth=0 */
  151. int opt_rdepth=0; /* optrdepth=0 */
  152.  
  153. /* Prototype */
  154. int proto_extern=1; /* genprotoextern */
  155. int proto_static=0; /* nogenprotostatic */
  156. int proto_parm=0; /* nogenprotoparm */
  157. int proto_typedef=1; /* genprototypedef */
  158. int proto_dataitem=1; /* genprotodataitem */
  159.  
  160. /* Linker */
  161. int lnk_smallcode=0; /* nosmallcode */
  162. int lnk_smalldata=0; /* nosmalldata */
  163. int lnk_addsym=0; /* noaddsym */
  164. int lnk_stripdebug=0; /* nostripdebug */
  165. int lnk_chkabort=1; /* chkabort */
  166. int lnk_batch=0; /* nobatch */
  167.  
  168. /* map */
  169. int map_hunk=0; /* nomaphunk */
  170. int map_symbols=0; /* nomapsymbols */
  171. int map_libraries=0; /* nomaplibraries */
  172. int map_xref=0; /* nomapxref */
  173. int map_overlay=0; /* nomapoverlay */
  174. */
  175.  
  176. /* Init() function */
  177. void init( void )
  178. {
  179.     if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  180.     {
  181.         EasyRequest(NULL,&miniErrorreq,0,"Can't open muimaster.library\nCheck if MUI is correctly installed\nand try again");
  182.         exit(20);
  183.     }
  184.     if (!(IconBase = OpenLibrary("icon.library",37)))
  185.     {
  186.         EasyRequest(NULL,&miniErrorreq,0,"Can't open icon.library\n");
  187.         exit(20);
  188.     }
  189. }
  190.  
  191. /* End() function */
  192. void end( void )
  193. {
  194.     CloseLibrary(MUIMasterBase);
  195.     CloseLibrary(IconBase);
  196. #ifdef DEBUG
  197.     ShowMemList();
  198.     ClearMemList();
  199. #endif
  200.     exit(20);
  201. }
  202. /* GenCodeC end() end */
  203.  
  204. /* Main Function inserted by GenCodeC */
  205. int main(int argc,char **argv)
  206. {
  207.     struct ObjApp * App = NULL;        /* Object */
  208.     struct DiskObject * SCOptsPlusIcon;    /* Disk (Icon) Object */
  209.         
  210.     BOOL    running = TRUE;
  211.     ULONG    signal;
  212.  
  213.     /* Program initialisation : opening libraries */
  214.     init();
  215.  
  216.     /* Create Object : generated by GenCodeC */
  217.     if (!(App = CreateApp()))
  218.     {
  219.         EasyRequest(NULL,&miniErrorreq,0,"Can't create MUI Application\n(Internal Error)");
  220.         end();
  221.     }
  222.  
  223.     /* open program's .icon file (if available) and use it when iconified */
  224.     SCOptsPlusIcon = GetDiskObject(_WBArgv[0]);
  225.     set(App->App, MUIA_Application_DiskObject,SCOptsPlusIcon);
  226.     
  227.     while (running)
  228.     {
  229.         switch (DoMethod(App->App,MUIM_Application_Input,&signal))
  230.         {
  231.             case MUIV_Application_ReturnID_Quit:
  232.                 running = FALSE;
  233.                 break;
  234.  
  235.             /* Insert your code between the "case" statement and comment "end of case ..." */
  236.             /* End computing of IDCMP */
  237.         }
  238.         if (running && signal) Wait(signal);
  239.     }
  240.     DisposeApp(App);
  241.     FreeDiskObject(SCOptsPlusIcon);
  242.     end();
  243. }
  244.  
  245. /* All MUI code is done! Proceed to the main program now */
  246.  
  247. /* Functions called by hooks */
  248.  
  249. /* About/MUI */
  250. APTR __saveds h_ABOUT_MUI(struct Hook *a0, APTR MNlabel1MUI, struct ObjApp *MyApp)
  251. {
  252.     static APTR aboutwin;
  253.  
  254.     if(!aboutwin)
  255.     {
  256.         aboutwin = AboutmuiObject,
  257.             MUIA_Window_RefWindow, MyApp->SCOPTS_MainWin,
  258.             MUIA_Aboutmui_Application, MNlabel1MUI,
  259.             End;
  260.     }
  261.     if(aboutwin)
  262.         set(aboutwin, MUIA_Window_Open, TRUE);
  263.     else
  264.         DisplayBeep(0);
  265. }
  266.  
  267. /* About/SCOptions */
  268. APTR __saveds h_ABOUT(struct Hook *a0, APTR MNlabel1SASCOptions, struct ObjApp *MyApp)
  269. {
  270.     MUI_Request(MyApp->App,MyApp->SCOPTS_MainWin,0,NULL,"OK","SAS/C SCOpts+ for SAS/C v6.59+\nCopyright © 1998, Infinity Labs\nVersion 0.5\n\nProgram author: Manolis S. Pappas");
  271. }
  272.  
  273.  
  274. /* Functions called by references */
  275.